#-*- coding:utf-8 -*-
import sys
import os

G_base_path =r'C:\CgTeamWork_v6\bin'
# G_base_path = os.path.dirname(os.path.dirname(__file__.replace("\\", "/")))
G_com_path = G_base_path + "/base/com_lib"
G_cgtw_path = G_base_path + "/base"
G_cgtw_pyside = G_base_path +'/lib/pyside'

if not G_base_path in sys.path:
    sys.path.append(G_base_path)
if not G_com_path in sys.path:
    sys.path.append(G_com_path)
if not G_cgtw_path in sys.path:
    sys.path.append(G_cgtw_path)
if not G_cgtw_pyside in sys.path:
    sys.path.append(G_cgtw_pyside)

from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
# from com_message_box import *

import cgtw2

def a():
    t_tw = cgtw2.tw()
    t_tw.task.set('proj_pltest', 'shot', ['C67E75D5-1C59-235D-26C4-33C2D87695B4'], {'task.status': 'Wait'})

# def submit_task(database,module,shot,task_id):# 这是5.3
#
#     t_tw = cgtw2.tw()
#     t_tw.task.set(database,module, [task_id], {'task.status': 'Check'})
#     t_tw.task.submit(database,module, task_id, [shot]) #

def submit_task(database,module,task_id,mov,note):# 这是5.3

    t_tw = cgtw2.tw()
    t_tw.task.set(database,module, [task_id], {'task.status': 'Check'})
    file_box = t_tw.task.get_submit_filebox(database, module, task_id)
    path = file_box.get('path','')
    # print(path)
    file_path = os.path.join(path,mov).replace('\\','/')
    print('file_path:',file_path)
    # t_tw.task.submit(database,module, task_id, file_path_list=[r'\\192.168.1.248\3d\temp\tmp\test_nuke\mov\LL01_01_002_efx_v003.mov'],note=note) #
    # t_tw.task.submit(database,module, task_id, file_path_list=[r'R:/PLTEST/Shot_work/FX/eps02/Render/LL01_01_002_efx_v003.mov'],note=note) #
    t_tw.task.submit(database,module, task_id, file_path_list=[file_path]) # ,note=note


if __name__ == '__main__':
    # a()
    # print(sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4])
    submit_task(sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4],sys.argv[5])#,sys.argv[4]